Skip to content

fix(background): pass full response to parse handler, not just body#2955

Closed
ImmanuelHaffner wants to merge 1 commit intoolimorris:mainfrom
ImmanuelHaffner:fix/background-parse-chat
Closed

fix(background): pass full response to parse handler, not just body#2955
ImmanuelHaffner wants to merge 1 commit intoolimorris:mainfrom
ImmanuelHaffner:fix/background-parse-chat

Conversation

@ImmanuelHaffner
Copy link
Copy Markdown

Description

Both ask_sync and ask_async were passing response.body (a raw JSON string) to the adapter's parse handler (e.g. chat_output). In non-streaming mode the handler expects the full response table {body, status, headers, …} and internally does data = data.body. Passing the pre-extracted string caused data.body to resolve to nil, silently breaking all background interactions (e.g. auto-title generation never produced a title).

Pass the full response table so the handler can extract .body itself, consistent with how the main chat HTTP path works.

AI Usage

Yes, Claude Opus 4.6 through CC ;)

Related Issue(s)

Screenshots

N/A

Checklist

  • I've read the contributing guidelines and have adhered to them in this PR
  • I confirm that this PR has been majority created by me, and not AI (unless stated in the "AI Usage" section above)
  • I've run make all to ensure docs are generated, tests pass and StyLua has formatted the code
  • (optional) I've added test coverage for this fix/feature
  • (optional) I've updated the README and/or relevant docs pages

Both ask_sync and ask_async were passing `response.body` (a raw JSON
string) to the adapter's parse handler (e.g. `chat_output`).  In
non-streaming mode the handler expects the full response table
`{body, status, headers, …}` and internally does `data = data.body`.
Passing the pre-extracted string caused `data.body` to resolve to nil,
silently breaking all background interactions (e.g. auto-title
generation never produced a title).

Pass the full `response` table so the handler can extract `.body`
itself, consistent with how the main chat HTTP path works.
@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the Stale label Apr 28, 2026
@olimorris
Copy link
Copy Markdown
Owner

This would potentially break user's configs as they're now expected to handle the body themselves. Given that would trigger a new major version of CodeCompanion, I'll hold off on this. Appreciate I may have done something dumb so I won't rule out changing this but given the limited feedback from people, I suspect this is okay for now. THank you for the PR though.

@olimorris olimorris closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants